package com.zd.attgen.service;

/**
 * 进度条类
 * @author zhang
 *
 */
public class ProgressBar implements Runnable {

	private String p = ".";
	private long sleepTime = 50;
	
	private boolean flag = true;
	
	public ProgressBar() {
	
	}

	@Override
	public void run() {
		while(flag) {
			System.out.print(p);
			try {
				Thread.sleep(sleepTime);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	
	public void start() {
		Thread t = new Thread(this);
		t.start();
	}
	
	public void stop() {
		flag = false;
		try {
			Thread.sleep(sleepTime);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
}
